<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%
request.setCharacterEncoding("UTF-8");
String htmlData = request.getParameter("content") != null ? request.getParameter("content") : ""; 
%>
<!DOCTYPE HTML>
<html>
  <head>
    <%@include file="../common.jsp"%>
    <title>新闻资讯列表</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">  
	<link rel="stylesheet" type="text/css" href="resources/css/common.css">
	<script type="text/javascript" src="resources/js/news/news.js"></script>  

	<!--kindEditor -->
    <link rel="stylesheet" href="resources/js/kindeditor/themes/default/default.css" />
	<link rel="stylesheet" href="resources/js/kindeditor/plugins/code/prettify.css" />
	<script charset="utf-8" src="resources/js/kindeditor/kindeditor.js"></script>
	<script charset="utf-8" src="resources/js/kindeditor/lang/zh_CN.js"></script>
	<script charset="utf-8" src="resources/js/kindeditor/plugins/code/prettify.js"></script> 
	
	<script src="resources/js/tag/jquery.tagsinput.js"></script>
	<link href="resources/js/tag/jquery.tagsinput.css" rel="stylesheet" />	

	<script>
 		KindEditor.ready(function(K) {
			var editor1 = K.create('textarea[name="content1"]', {
				cssPath : 'resources/js/kindeditor/plugins/code/prettify.css',
				uploadJson : 'resources/js/kindeditor/jsp/upload_json.jsp',
				fileManagerJson : 'resources/js/kindeditor/jsp/file_manager_json.jsp',
				allowFileManager : true,
/* 				afterCreate : function() {
					var self = this;
					K.ctrl(document, 13, function() {
						self.sync();
						document.forms['example'].submit();
					});
					K.ctrl(self.edit.doc, 13, function() {
						self.sync();
						document.forms['example'].submit();
					});
				}  */
				
				afterBlur: function(){
					this.sync();
				}
			});
			prettyPrint();
		});
		
	</script>
  </head>
  <body>
<!-- 		<div id="container">
			<a id="selectfiles" href="javascript:void(0);">
				<img id="previewImg" width="300px" height="191px" src="resources/images/uploadPic.jpg">
			</a>
		</div> -->
		
		
		
		
		
		   	<div class="content">
   		<h4>新闻资讯列表</h4>
   		<hr/>
   		<!-- 查询面板 -->
<!--    		<div class="panel panel-default">
		    <div class="panel-heading">
		      <h4 class="panel-title">
		        <a data-toggle="collapse" data-parent="#accordion" href="#collapseSearch">
		           	<i class="icon icon-search"></i> 查询过滤
		        </a>
		      </h4>
		    </div>
		    <div id="collapseSearch" class="panel-collapse collapse out">
		      <div class="panel-body">
				  <form id="form_search" class="form-horizontal">
			        <div class="form-group">
			          	<label class="col-md-1 control-label">昵称</label>
			          	<div class="col-md-4">
			             	<input type="text" name="nickName" id="search_nickName" class="form-control" placeholder="模糊查询...">
			          	</div>
			          	<label class="col-md-1 control-label">手机号</label>
			          	<div class="col-md-4">
			             	<input type="text" name="phone" id="search_phone" class="form-control" placeholder="模糊查询...">
			          	</div>
			        </div>
			        <div class="form-group">
			          <div class="col-md-offset-1 col-md-11">
			             <button id="btn_search" class="btn btn-default"><i class="icon icon-search"></i> 查询</button>
			             <button id="btn_reset" class="btn btn-default"><i class="icon icon-undo"></i> 重置</button>
			          </div>
			        </div>
			      </form>
		      </div>
		    </div>
		</div> -->
		
	    <!-- 工具栏 -->
   		<div class="tools"> 
	    	<button id="btn_add" type="button" class="btn btn-primary"><i class="icon icon-plus-sign"></i>  增加新闻资讯</button>
	    	<!-- <button id="btn_scan" type="button" class="btn btn-primary"><i class="icon icon-plus-sign"></i>  文件详情</button> -->
	    	<button id="btn_del" type="button"  class="btn btn-warning"><i class="icon icon-minus-sign"></i>  删除</button>
<!-- 	    	<div id="btn_status" class="btn-group" style="float: right;">
			  	<button type="button" class="btn btn-default active" id="0">正常</button>
			  	<button type="button" class="btn btn-danger" id="1">冻结</button>
			</div>	 -->		
	    </div>
	    <!-- 列表 -->
	    <table id="tab_list" class="table table-hover table-striped mytable">
			<thead>
				<tr>
					<th style="width: 2%;"><input id="pkall" type='checkbox' class='checkbox'></th>
					<th style="width: 3%;">序号</th>
					<th style="width: 5%;">标题 </th>
					<th style="width: 5%;">上传时间</th>
					<th style="width: 10%;">收藏次数</th>
				 	<th style="width: 10%;">评论数</th>
					<th style="width: 10%;">浏览次数 </th>
					<th style="width: 10%;">是否认证</th>
					<th style="width: 10%;">是否删除</th>
				</tr>
			</thead>
			<tbody>
				
			</tbody>
	  	</table>
	  	<!-- 分页信息条 -->
	  	<div id="pagebar" class="pagebar">
		  	<ul class="pager">
		  		
			</ul>
			<p id="page_info" class="page_info">显示第<span>0</span>到第<span>0</span>条记录,共<span>0</span>条</p>
	  	</div>
	  	
	  	<!-- 添加 -->
		 <div class="modal fade bs-example-modal-lg" id="modal_add" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
		  <div class="modal-dialog modal-lg">
		    <div class="modal-content">
		      <div class="modal-header">
		        <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
		        <h4 class="modal-title" id="myModalLabel">添加新闻资讯</h4>
		      </div>
		      <div class="modal-body">

		         <form id="form_add" class="form-horizontal" role="form">
		         	<input type="hidden" name="url" id="url">
			         <div class="form-group">
							  <label class="col-sm-2 control-label required">图片</label>
							  <div class="col-sm-10">
									<div id="container">
										<a id="selectfiles" href="javascript:void(0);">
											<img id="previewImg" width="300px" height="191px" src="resources/images/uploadPic.jpg">
										</a>
									</div>								
							  </div>
						  </div>
					  
				  	  <div class="form-group">
						  <label class="col-sm-2 control-label required">标题</label>
						  <div class="col-sm-4">
						     <input type="text" name="name" placeholder="100字以内,如:建筑设计" class="form-control" data-toggle="tooltip" data-placement="top" title="请输入标题" >
						  </div>
						  <label class="col-sm-2 control-label required">摘要</label>
						  <div class="col-sm-4">
						     <input type="text" name="summary" placeholder="500字以内,如:建筑设计" class="form-control" data-toggle="tooltip" data-placement="top" title="请输入摘要" >
						</div>
					  </div>
					  					 						
					  <div class="form-group">
							<label class="col-sm-2 control-label required">作者</label>
						  <div class="col-sm-4">
						     <input type="text" name="author" placeholder="50字以内,如:张三" class="form-control" data-toggle="tooltip" data-placement="top" title="请输入作者" >
						  </div>	
						  <label class="col-sm-2 control-label required">来源</label>
						  <div class="col-sm-4">
						     <input type="text" name="source" placeholder="500字以内,如:www.baidu.com" class="form-control" data-toggle="tooltip" data-placement="top" title="请输入来源" >
						  </div>	
						</div>

				  	  <div class="form-group">
						  <label class="col-sm-2 control-label required">新闻类别</label>
						  <div class="col-sm-4">
							<select class="form-control" name="type" placeholder="选择文件格式" data-toggle="tooltip" data-placement="top" title="请选择文件格式">
								<option value="0" selected="selected">请选择...</option>
							</select> 
						</div>
						  
						  <label class="col-sm-2 control-label required">浏览的基数</label>
						  	<div class="col-sm-4">
								<input type="number" name="cardinal" placeholder="" class="form-control" data-toggle="tooltip" data-placement="top" title="请输入浏览基数"> 
							</div>
					  </div>
				  	  <div class="form-group">
						  <label class="col-sm-2 control-label required">标签</label>
						  <div class="col-sm-10">
							<input id="tags" type="text" class="tags" value="" />
						  </div>
					  </div>
				  	  <div class="form-group">
						  <label class="col-sm-2 control-label required">新闻内容</label>
						  <div class="col-sm-10">
							<%=htmlData%>
							<!-- <form name="example" method="post" action="file_list.jsp"> -->
								<textarea id ="content" name="content1" cols="100" rows="8" style="width:100%;height:200px;"><%=htmlspecialchars(htmlData)%></textarea>
								<br />
								<!--<input type="submit" name="button" value="提交内容" /> (提交快捷键: Ctrl + Enter)
							 </form>	 -->				
						</div>
					  </div>
				</form>
		      </div>
		      <div class="modal-footer">
					<button id="btn_confirm_add" type="button" class="btn btn-primary">确定</button>
		      </div>
		    </div>
	   </div>
	</div>
 </div>		
  </body>
  	<script src="resources/js/lib/plupload-2.1.2/js/plupload.full.min.js" type="text/javascript" charset="utf-8"></script>
	 <script src="resources/js/upload.js" type="text/javascript" charset="utf-8"></script>
</html>
<%!
private String htmlspecialchars(String str) {
	str = str.replaceAll("&", "&amp;");
	str = str.replaceAll("<", "&lt;");
	str = str.replaceAll(">", "&gt;");
	str = str.replaceAll("\"", "&quot;");
	return str;
}
%>